import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {h} from "vue";
import {Tag} from "ant-design-vue";
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '订单号',
    align: "center",
    dataIndex: 'orderNo'
  },
  {
    title: '保单号',
    width: 240,
    align: "center",
    dataIndex: 'policyNo'
  },
  {
    title: '订单归属',
    width: 240,
    align: "center",
    customRender: ({ record }) => {
      if(record.salesmanName&&record.salesmanName.length>0){
        return record.salesmanName;
      }
      if(record.channelName&&record.channelName.length>0){
        return record.channelName;
      }
      return  '';
    },
    dataIndex: 'guishu'
  },
  {
    title: '订单来源',
    align: "center",
    dataIndex: 'sourceType_dictText'
  },
  {
    title: '支付时间',
    align: "center",
    dataIndex: 'payTime'
  },
  {
    title: '付款人名称',
    align: "center",
    width: 200,
    dataIndex: 'payAccountName'
  },
  {
    title: '出保时间',
    align: "center",
    dataIndex: 'insureActiveDate'
  },

  {
    title: '保费',
    align: "center",
    dataIndex: 'cost'
  },
  {
    title: '渠道商',
    align: "center",
    dataIndex: 'channelProvider'
  },
  {
    title: '地区',
    align: "center",
    dataIndex: 'area_dictText'
  },
  {
    title: '平台',
    align: "center",
    dataIndex: 'platformCode_dictText'
  },
  {
    title: '保险公司',
    align: "center",
    dataIndex: 'insuranceCompany_dictText'
  },
  {
    title: '被保人',
    align: "center",
    dataIndex: 'insuredName'
  },
  {
    title: '投保人名称',
    align: "center",
    dataIndex: 'policyHolderName'
  },
  {
    title: '项目名称',
    align: "center",
    dataIndex: 'projectName'
  },
  {
    title: '项目编号',
    align: "center",
    dataIndex: 'projectId'
  },
  {
    title: '保证金',
    align: "center",
    dataIndex: 'margin'
  },
  {
    title: '开标时间',
    align: "center",
    dataIndex: 'kaiBiaoTime'
  },

];

//查询数据
export const searchFormSchema: FormSchema[] = [
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '订单创建日期',
    field: 'orderCreateTime',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入订单创建日期!'},
             ];
    },
  },
  {
    label: '下单时间',
    field: 'applyTime',
    component: 'Input',
  },
  {
    label: '支付时间',
    field: 'payTime',
    component: 'DatePicker',
  },
  {
    label: '付款人名称',
    field: 'payAccountName',
    component: 'Input',
  },
  {
    label: '被保人',
    field: 'insuredName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入被保人!'},
             ];
    },
  },
  {
    label: '出保时间',
    field: 'insureActiveDate',
    component: 'DatePicker',
  },
  {
    label: '订单号',
    field: 'orderNo',
    component: 'Input',
  },
  {
    label: '保单号',
    field: 'policyNo',
    component: 'Input',
  },
  {
    label: '支付状态',
    field: 'payState',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入支付状态!'},
             ];
    },
  },
  {
    label: '保险状态',
    field: 'policyState',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入保险状态!'},
             ];
    },
  },
  {
    label: '订单来源',
    field: 'sourceType',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入订单来源!'},
             ];
    },
  },
  {
    label: '保费',
    field: 'cost',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入保费!'},
             ];
    },
  },
  {
    label: '平台',
    field: 'platformCode',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入平台!'},
             ];
    },
  },
  {
    label: '保险公司',
    field: 'insuranceCompany',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入保险公司!'},
             ];
    },
  },
  {
    label: '渠道商',
    field: 'channelProvider',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入渠道商!'},
             ];
    },
  },
  {
    label: '费率',
    field: 'rate',
    component: 'InputNumber',
  },
  {
    label: '地区',
    field: 'area',
    component: 'Input',
  },
  {
    label: '保证金',
    field: 'margin',
    component: 'InputNumber',
  },
  {
    label: '渠道结算订单id',
    field: 'channelSettlementId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入渠道结算订单id!'},
             ];
    },
  },
  {
    label: '业务结算汇总订单id',
    field: 'salesmanSettlementId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入业务结算汇总订单id!'},
             ];
    },
  },
  {
    label: '保险公司结算汇总订单id',
    field: 'insuranceSettlementId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入保险公司结算汇总订单id!'},
             ];
    },
  },
  {
    label: '业务人员名称',
    field: 'salesmanName',
    component: 'Input',
  },
  {
    label: '渠道名称',
    field: 'channelName',
    component: 'Input',
  },
  {
    label: '不含税保费',
    field: 'exTaxPremium',
    component: 'InputNumber',
  },
  {
    label: '保险公司经纪费比例',
    field: 'insuranceFeeRate',
    component: 'InputNumber',
  },
  {
    label: '保险公司经纪费',
    field: 'insuranceFee',
    component: 'InputNumber',
  },
  {
    label: '渠道经纪费比例',
    field: 'channelFeeRate',
    component: 'InputNumber',
  },
  {
    label: '渠道经纪费',
    field: 'channelFee',
    component: 'InputNumber',
  },
  {
    label: '业务员经纪费比例',
    field: 'salesmanFeeRate',
    component: 'InputNumber',
  },
  {
    label: '业务员经纪费',
    field: 'salesmanFee',
    component: 'InputNumber',
  },
  {
    label: '系统服务商经纪费',
    field: 'systemFee',
    component: 'InputNumber',
  },
  {
    label: '投保人名称',
    field: 'policyHolderName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入投保人名称!'},
             ];
    },
  },
  {
    label: '项目名称',
    field: 'projectName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入项目名称!'},
             ];
    },
  },
  {
    label: '系统服务商纪费',
    field: 'systemRate',
    component: 'InputNumber',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
